	
	<%@ page language="java" contentType="text/html" %>
	<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
	
	<jsp:useBean id="taschenrechner" scope="request" class="mvc.example.model.Ergebnis" type="mvc.example.model.Ergebnis" />
	<jsp:useBean id="fehlermeldungen" scope="request" class="java.util.TreeSet" type="java.util.TreeSet" />
				
	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
	
	<c:set var="zahl1" value="${taschenrechner.zahl1}" /> 
	<c:set var="zahl2" value="${taschenrechner.zahl2}" />
			
	<c:if test="${!empty param.calc and empty fehlermeldungen}">
		<c:set var="zahl1" value="${taschenrechner.ergebnis}" /> 
		<c:set var="zahl2" value="0.0" /> 
	</c:if>
	
	<html>
		<head>
			<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
			<title>Taschenrechner MVC Beispiel</title>
			<link rel="stylesheet" href="/w_mvc/style.css" media="screen" type="text/css" >
			<script type="text/javascript" src="/w_mvc/script.js"></script>
		</head>
		<body>			
			<c:if test="${!empty fehlermeldungen}">
				<strong>Folgende Fehler sind aufgetreten:</strong>
				<ul>
					<c:forEach var="fehlerBeschreibung" items="${fehlermeldungen}">
						<li>${fehlerBeschreibung}</li>
					</c:forEach>
				</ul>
			</c:if>							
			<form name="calculator" action="/w_mvc/servlet/Controller" method="post">
				<input type="hidden" name="operator" value="" />
				<input type="hidden" name="zahl1" value="${zahl1}" />
				<input type="hidden" name="zahl2" value="${zahl2}" />
				<table cellpadding="4" border="0" cellspacing="2">
					<tr>
						<td colspan="5"><div id="anzeige">&#160;</div></td>
					</tr>
					<tr>
						<td><input type="button" value="7" onclick="Calculator.set(this.value)"/></td>
						<td><input type="button" value="8" onclick="Calculator.set(this.value)"/></td>
						<td><input type="button" value="9" onclick="Calculator.set(this.value)"/></td>
						<td><input type="button" onclick="Calculator.setOperator(this.value);" value="/" /></td>
						<td><input type="button" onclick="Calculator.resetFields(true);" value="CE" /></td>
					</tr>
					<tr>
						<td><input type="button" value="4" onclick="Calculator.set(this.value)"/></td>
						<td><input type="button" value="5" onclick="Calculator.set(this.value)"/></td>
						<td><input type="button" value="6" onclick="Calculator.set(this.value)"/></td>
						<td><input type="button" onclick="Calculator.setOperator(this.value);" value="*" /></td>
						<td><input type="button" onclick="Calculator.resetFields(false);" value="C" /></td>
					</tr>
					<tr>
						<td><input type="button" value="1" onclick="Calculator.set(this.value)"/></td>
						<td><input type="button" value="2" onclick="Calculator.set(this.value)"/></td>
						<td><input type="button" value="3" onclick="Calculator.set(this.value)"/></td>
						<td><input type="button" onclick="Calculator.setOperator(this.value);" value="-" /></td>
						<td />
					</tr>
					<tr>
						<td><input type="button" value="0" onclick="Calculator.set(this.value)"/></td>
						<td><input type="button" onclick="Calculator.setAccidental();" value="+/-" /></td>
						<td><input type="button" onclick="Calculator.setComma();" value="," /></td>
						<td><input type="button" onclick="Calculator.setOperator(this.value);" value="+" /></td>
						<td><input type="submit" name="calc" value="=" /></td>
					</tr>
				</table>
			</form>
			<script type="text/javascript">
				Calculator.init();
			</script>
		</body>
	</html>